import tkinter as tk
from tkinter import *
from pyant.simulation.antground import Antground

class AntgroundCanv(Frame, Antground):
    def __init__(self, parent=None, color='brown'):
        Frame.__init__(self, parent)
        Antground.__init__(self)
        
        self.pack(expand=YES, fill=BOTH)                  
        canv = Canvas(self, bg=color, relief=SUNKEN)
        canv.config(width=300, height=200)                
        canv.config(scrollregion=(0,0,300, 1000))         
        canv.config(highlightthickness=0)                 

        y_sbar = Scrollbar(self)
        y_sbar.config(command=canv.yview)                   
        canv.config(yscrollcommand=y_sbar.set)              
        y_sbar.pack(side=RIGHT, fill=Y)

        x_sbar = Scrollbar(self, orient=HORIZONTAL)
        x_sbar.config(command=canv.xview)                   
        canv.config(xscrollcommand=x_sbar.set)              
        x_sbar.pack(side=BOTTOM, fill=X)
        
        canv.pack(side=LEFT, expand=YES, fill=BOTH)
        
        self.canvas = canv

class MainWindow:
    def __init__(self):
        self.root = tk.Tk()
        self.create_menu()
        self.create_content()
        self.ground = AntgroundCanv(parent=self.root)

    def create_menu(self):
        menu = tk.Menu(self.root)
        filemenu = tk.Menu(menu)
        menu.add_cascade(label='File', menu=filemenu)
        filemenu.add_command(label='New program', command=self.new_program)
        filemenu.add_command(label='Open program', command=self.open_program)
        filemenu.add_separator()
        filemenu.add_command(label='Exit', command=self.root.destroy)
        self.root.config(menu=menu)

    def create_content(self):
        tribesframe = tk.Frame(self.root, width=200, height=200,
                               relief="sunken", bd=2)
        tribesframe.pack(side="left")

    def create_antground(self):
        frame = tk.Frame(self.root, width=200, height=200,
                                  relief="sunken", bd=2)
        antground = tk.Canvas(frame, width=200, height=2000)

        x_srollbar = tk.Scrollbar(self.root)
        y_srollbar = tk.Scrollbar(self.root)

        antground.config(xscrollcommand=x_srollbar.set)
        antground.config(yscrollcommand=y_srollbar.set)

        x_srollbar.config(command=antground.xview)
        y_srollbar.config(command=antground.yview)
        
        x_srollbar.pack(side=tk.BOTTOM, fill=tk.X)
        y_srollbar.pack(side=tk.RIGHT, fill=tk.Y)
        
        antground.pack()
        frame.pack(side="right")
        
        

    def new_program(self):
        #import idlelib.idle
        print(self.antground.winfo_height())
        

    def open_program(self):
        test = tk.filedialog.askopenfilename(filetypes=[("pythonfiles","*.py")])

def main():
    window = MainWindow()
    tk.mainloop()

if __name__ == "__main__":
    main()


from tkinter import * 
